package com.api.shopapi.mapper;


import com.api.shopapi.entity.MedicationSchedulingNightItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface MedicationSchedulingNightItemMapper {

    @Insert("insert into medication_scheduling_night_item " +
            "(MedicationSchedulingNightItemCode,MedicationSchedulingNightCode,Name) " +
            "values (#{medicationSchedulingNightItem.MedicationSchedulingNightItemCode} ,#{medicationSchedulingNightItem.MedicationSchedulingNightCode} ,#{medicationSchedulingNightItem.Name} )")
    int insert(@Param("medicationSchedulingNightItem") MedicationSchedulingNightItem medicationSchedulingNightItem);

    @Update("update medication_scheduling_night_item set MedicationSchedulingNightCode=#{medicationSchedulingNightItem.MedicationSchedulingNightCode} ,Name=#{medicationSchedulingNightItem.Name} " +
            "where medicationSchedulingNightItemCode=#{medicationSchedulingNightItem.medicationSchedulingNightItemCode}  ")
    int updateByMedicationSchedulingNightItemCode(@Param("medicationSchedulingNightItem") MedicationSchedulingNightItem medicationSchedulingNightItem);

    @Delete("delete from medication_scheduling_night_item where MedicationSchedulingNightItemCode=#{medicationSchedulingNightItemCode} ")
    int deleteByMedicationSchedulingNightItemCode(@Param("medicationSchedulingNightItemCode") String medicationSchedulingNightItemCode);

    @Select("select * from medication_scheduling_night_item where MedicationSchedulingNightItemCode=#{medicationSchedulingNightItemCode} limit 1")
    MedicationSchedulingNightItem getByMedicationSchedulingNightItemCode(@Param("medicationSchedulingNightItemCode")String medicationSchedulingNightItemCode);

    @Select("select * from medication_scheduling_night_item where MedicationSchedulingNightCode=#{medicationSchedulingNightCode}")
    List<MedicationSchedulingNightItem> getListByMedicationSchedulingNightCode(@Param("medicationSchedulingNightCode")String medicationSchedulingNightCode);

    @Delete("delete from medication_scheduling_night_item where MedicationSchedulingNightCode=#{medicationSchedulingNightCode} ")
    int deleteByMedicationSchedulingNightCode(String medicationSchedulingNightCode);
}
